package com.webserver5.core;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class BirdBootApplication {
    private ServerSocket serverSocket;
    private ExecutorService threadPool;
    public BirdBootApplication(){
        try {
            serverSocket = new ServerSocket(8089);
            threadPool = Executors.newFixedThreadPool(50);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void start(){
        try {
            Socket socket = serverSocket.accept();
            ClientHandler handler = new ClientHandler(socket);
            threadPool.execute(handler);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        BirdBootApplication application = new BirdBootApplication();
        application.start();
    }
}
